#pragma once
#include "BondDetailPrcRelevanceFilter.h"
#include "BondDetailNotice.h"
#include <QWidget>
#include <QPushButton>
#include <widgets/SDialog.h>
#include <qbtools/message/MessagePoster.h>
#include <QTabWidget>
class DetailData;
class QTableWidget;
class BondDetailNotice;
class BondDetailPrcRelFilter;

enum TabType{
	emIdxNotice = 0, 
	emIdxIssuer, 
	emIdxSecond, 
	emIdxPrimary 
};

class BondDetailPrcRelevance : public QWidget
{
	Q_OBJECT
public:
    BondDetailPrcRelevance(QWidget* p, QSharedPointer<DetailData> data);
    void setBondInfo(QSharedPointer<DetailData> data);
	BondDetailPrcRelevanceFilter* getIssureRelevance() { return m_pIssuer; }
	BondDetailPrcRelevanceFilter* getSecondRelevance() { return m_pSecond; }
	BondDetailPrcRelevanceFilter* getFirstRelevance() { return  m_pFirst; }
protected:
	void initTabIndx();
	void initCreditIdx();
	void initOthersIdx();
	void initTab(int nTab);
	void refreshData();
	void loadTabWidget(int tabId);
	bool isLoaded(QString strKey);
Q_SIGNALS:
	void getbClickKeyInfo(bool clicked , std::string key);
	void loadTabFinish();
private:
	CBondInfo						m_bi;
	std::vector<int>				m_vec;
    QSharedPointer<DetailData>      m_data = nullptr;
	QTabWidget*						m_tabWidget = nullptr;
	int								m_nTabCount = 3;
	int								m_nCurrentTab;
	std::map<QString, bool>			m_mapRecord;
	BondDetailNotice*				m_pNotice = nullptr;
	BondDetailPrcRelevanceFilter*	m_pIssuer = nullptr;
	BondDetailPrcRelevanceFilter*	m_pSecond = nullptr;
	BondDetailPrcRelevanceFilter*	m_pFirst = nullptr;
};